home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / advqcc.zip / PR_COMP.H < prev    next >
Text File  |  1996-07-24  |  2KB  |  162 lines

  1.  
  2. // this file is shared by quake and qcc
  3.  
  4. typedef int    func_t;
  5. typedef int    string_t;
  6.  
  7. typedef enum {ev_void, ev_string, ev_float, ev_vector, ev_entity, ev_field, ev_function, ev_pointer} etype_t;
  8.  
  9.  
  10. #define    OFS_NULL        0
  11. #define    OFS_RETURN        1
  12. #define    OFS_PARM0        4        // leave 3 ofs for each parm to hold vectors
  13. #define    OFS_PARM1        7
  14. #define    OFS_PARM2        10
  15. #define    OFS_PARM3        13
  16. #define    OFS_PARM4        16
  17. #define    OFS_PARM5        19
  18. #define    OFS_PARM6        22
  19. #define    OFS_PARM7        25
  20. #define    RESERVED_OFS    28
  21.  
  22.  
  23. enum {
  24.     OP_DONE,
  25.     OP_MUL_F,
  26.     OP_MUL_V,
  27.     OP_MUL_FV,
  28.     OP_MUL_VF,
  29.     OP_DIV_F,
  30.     OP_ADD_F,
  31.     OP_ADD_V,
  32.     OP_SUB_F,
  33.     OP_SUB_V,
  34.     
  35.     OP_EQ_F,
  36.     OP_EQ_V,
  37.     OP_EQ_S,
  38.     OP_EQ_E,
  39.     OP_EQ_FNC,
  40.     
  41.     OP_NE_F,
  42.     OP_NE_V,
  43.     OP_NE_S,
  44.     OP_NE_E,
  45.     OP_NE_FNC,
  46.     
  47.     OP_LE,
  48.     OP_GE,
  49.     OP_LT,
  50.     OP_GT,
  51.  
  52.     OP_LOAD_F,
  53.     OP_LOAD_V,
  54.     OP_LOAD_S,
  55.     OP_LOAD_ENT,
  56.     OP_LOAD_FLD,
  57.     OP_LOAD_FNC,
  58.  
  59.     OP_ADDRESS,
  60.  
  61.     OP_STORE_F,
  62.     OP_STORE_V,
  63.     OP_STORE_S,
  64.     OP_STORE_ENT,
  65.     OP_STORE_FLD,
  66.     OP_STORE_FNC,
  67.  
  68.     OP_STOREP_F,
  69.     OP_STOREP_V,
  70.     OP_STOREP_S,
  71.     OP_STOREP_ENT,
  72.     OP_STOREP_FLD,
  73.     OP_STOREP_FNC,
  74.  
  75.     OP_RETURN,
  76.     OP_NOT_F,
  77.     OP_NOT_V,
  78.     OP_NOT_S,
  79.     OP_NOT_ENT,
  80.     OP_NOT_FNC,
  81.     OP_IF,
  82.     OP_IFNOT,
  83.     OP_CALL0,
  84.     OP_CALL1,
  85.     OP_CALL2,
  86.     OP_CALL3,
  87.     OP_CALL4,
  88.     OP_CALL5,
  89.     OP_CALL6,
  90.     OP_CALL7,
  91.     OP_CALL8,
  92.     OP_STATE,
  93.     OP_GOTO,
  94.     OP_AND,
  95.     OP_OR,
  96.     
  97.     OP_BITAND,
  98.     OP_BITOR
  99. };
  100.  
  101.  
  102. typedef struct statement_s
  103. {
  104.     unsigned short    op;
  105.     short    a,b,c;
  106. } dstatement_t;
  107.  
  108. typedef struct
  109. {
  110.     unsigned short    type;        // if DEF_SAVEGLOBGAL bit is set
  111.                                 // the variable needs to be saved in savegames
  112.     unsigned short    ofs;
  113.     int            s_name;
  114. } ddef_t;
  115. #define    DEF_SAVEGLOBGAL    (1<<15)
  116.  
  117. #define    MAX_PARMS    8
  118.  
  119. typedef struct
  120. {
  121.     int        first_statement;    // negative numbers are builtins
  122.     int        parm_start;
  123.     int        locals;                // total ints of parms + locals
  124.     
  125.     int        profile;        // runtime
  126.     
  127.     int        s_name;
  128.     int        s_file;            // source file defined in
  129.     
  130.     int        numparms;
  131.     byte    parm_size[MAX_PARMS];
  132. } dfunction_t;
  133.  
  134.  
  135. #define    PROG_VERSION    6
  136. typedef struct
  137. {
  138.     int        version;
  139.     int        crc;            // check of header file
  140.     
  141.     int        ofs_statements;
  142.     int        numstatements;    // statement 0 is an error
  143.  
  144.     int        ofs_globaldefs;
  145.     int        numglobaldefs;
  146.     
  147.     int        ofs_fielddefs;
  148.     int        numfielddefs;
  149.     
  150.     int        ofs_functions;
  151.     int        numfunctions;    // function 0 is an empty
  152.     
  153.     int        ofs_strings;
  154.     int        numstrings;        // first string is a null string
  155.  
  156.     int        ofs_globals;
  157.     int        numglobals;
  158.     
  159.     int        entityfields;
  160. } dprograms_t;
  161.  
  162.